from pathlib import Path
from db.import_data import db_data_import

# 导入初始数据
data ={
    "department": {
        "cols": ('id', 'name', 'parent'),
        "values": [(1, '75000部队', 0),
                   (2, '1营', 1),
                   (3, '2营', 1),
                   (4, '3营', 1),
                   (5, '4营', 1),
                   (6, '1营1连', 2),
                   (7, '1营2连', 2),
                   (8, '1营3连', 2),
                   (9, '2营1连', 3),
                   (10, '2营2连', 3),
                   (11, '2营3连', 3),
                   (12, '3营1连', 4),
                   (13, '3营2连', 4),
                   (14, '3营3连', 4),
                   (15, '4营1连', 5),
                   (16, '4营2连', 5),
                   (17, '4营3连', 5),
                   ]
    },
    "user": {
        "cols": ('number', 'password', 'name', 'rank','dep', 'online', 'role'),
        "values": [('1000', '1000', 'admin', '中士', 1, 0, 'admin'),
                   ('1001', '1001', '王一', '下士', 8, 0, 'user'),
                   ('1002', '1002','王二', '义务兵', 11, 0, 'user'),
                   ('1003', '1003', '王三', '义务兵', 12, 0, 'user'),
                   ('1004', '1004', '王四', '下士', 10, 0, 'user'),
                   ('1005', '1005', '王五', '中尉', 7, 0, 'user'),
                   ('1006', '1006', '李一', '下士', 9, 0, 'user'),
                   ('1007', '1007', '李二', '中士', 9, 0, 'user'),
                   ('1008', '1008', '李三', '上尉', 9, 0, 'user'),
                   ('1009', '1009', '李四', '中士', 11, 0, 'user'),
                   ('1010', '1010', '李五', '少校', 8, 0, 'user'),
                   ('1011', '1011', '李六', '上尉', 14, 0, 'user'),
                   ('1012', '1012', '张一', '中士', 14, 0, 'user'),
                   ('1013', '1013', '张二', '下士', 14, 0, 'user'),
                   ('1014', '1014', '张三', '中士', 15, 0, 'user'),
                   ('1015', '1015', '张四', '上尉', 15, 0, 'user'),
                   ('1016', '1016', '张五', '下士', 15, 0, 'user'),
                   ('1017', '1017', '黄一', '中士', 16, 0, 'user'),
                   ('1018', '1018', '黄二', '下士', 16, 0, 'user'),
                   ('1019', '1019', '黄三', '义务兵', 16, 0, 'user'),
                   ('1020', '1020', '黄四', '上尉', 17, 0, 'user'),
                   ('1021', '1021', '许一', '义务兵', 17, 0, 'user'),
                   ('1022', '1022', '许二', '义务兵', 6, 0, 'user'),
                   ('1023', '1023', '许三', '上尉', 6, 0, 'user'),
                   ('1024', '1024', '许四', '中士', 6, 0, 'user'),
                   ('1025', '1025', '许五', '上尉', 8, 0, 'user'),
                   ]
    },
    "formatted_message_category": {
        "cols": ('name',),
        "values": [('侦察指令',),
                   ('火力打击',),
                   ('毁伤评估',),
                   ('其他',)
                   ]
    },

    "formatted_message": {
        "cols": ('id', 'name', 'text', 'elementlist', 'category'),
        "values": [(1, '侦察报告', '敌位置{dw}，火力配置{hl}，环境情况{hj}', 'dw|hl|hj', '侦察指令'),
                   (2, '侦察敌方位置', '命令：侦察敌方位置配置', '', '侦察指令'),
                   (3, '侦察敌方火力', '命令：侦察敌方火力配置', '', '侦察指令'),
                   (4, '火力打击报告', '敌主力{d}，核心要点{hx}，残存火力{cc}，评估结论{pg}', 'd|hx|cc|pg', '火力打击'),
                   (5, '火力覆盖敌方阵地', '命令：火力覆盖敌方阵地', '', '火力打击'),
                   (6, '狙击', '命令：狙击敌{d}', 'd', '火力打击'),
                   (7, '突击', '命令：向{mb}突击，完成{rw}', 'mb|rw', '火力打击'),
                   (8, '打击评估报告', '执行{ml}命令完成，任务目标完成度{wc}，建议{jy}', 'ml|wc|jy', '毁伤评估'),
                   (9, '毁伤评估', '命令：立即对敌毁伤评估', '', '毁伤评估'),
                   (10, '自由报文', '', '', '其他'),
                   ]
    },
}

db = Path(__file__).parent.parent / 'db/db.sqlite3'


# 使用实体类在数据库中插入初始数据
def db_init():
    db_data_import(data, db)
